
#if !defined (_GHOOK_H)
#define _GHOOK_H

#define WIN32_LEAN_AND_MEAN
#include <windows.h>
#include <stdio.h>

namespace gh
{

#define MakePtr(cast, ptr, addValue ) (cast)( (DWORD)(ptr)+(DWORD)(addValue))

#pragma pack(push, 1)
	struct DLPD_IAT_STUB
	{
		BYTE instr_CALL;
		DWORD data_call;
		BYTE instr_JMP;
		DWORD data_JMP;
		DWORD count;
		DWORD pszNameOrOrdinal;

		DLPD_IAT_STUB() : instr_CALL(0xE8), instr_JMP(0xE9), count(0) 
		{ }
	};
#pragma pack(pop)

	struct FunctionHook
	{
		char* Name;
		void* HookFunction;
		void* OriginalFunction;
	};

	struct DLLHook
	{
		char* Name;

		bool UseDefault;
		void* DefaultFn;

		FunctionHook Functions[];
	};

	bool HookAPICalls(DLLHook* Hook);

}

#endif
